package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.system.domain.RentalSysOrders;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.YongRentalSysVehicle;
import com.ruoyi.system.service.IYongRentalSysVehicleService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.service.IRentalSysOrdersService;
/**
 * 本公司车辆列表Controller
 * 
 * @author Mag1c_-xyy
 * @date 2024-04-25
 */
@RestController
@RequestMapping("/system/vehicleYong")
public class YongRentalSysVehicleController extends BaseController
{
    @Autowired
    private IYongRentalSysVehicleService yongRentalSysVehicleService;
    @Autowired
    private IRentalSysOrdersService rentalSysOrdersService;

    /**
     * 查询本公司车辆列表列表
     */
    @PreAuthorize("@ss.hasPermi('system:vehicleYong:list')")
    @GetMapping("/list")
    public TableDataInfo list(YongRentalSysVehicle yongRentalSysVehicle)
    {
        startPage();
        List<YongRentalSysVehicle> list = yongRentalSysVehicleService.selectYongRentalSysVehicleList(yongRentalSysVehicle);
        return getDataTable(list);
    }

    /**
     * 新增租赁订单
     */
    @PreAuthorize("@ss.hasPermi('system:orders:add')")
    @Log(title = "租赁订单", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody RentalSysOrders rentalSysOrders)
    {
        return toAjax(rentalSysOrdersService.insertRentalSysOrders(rentalSysOrders));
    }

    /**
     * 获取本公司车辆列表详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:vehicleYong:query')")
    @GetMapping(value = "/{vehicleId}")
    public AjaxResult getInfo(@PathVariable("vehicleId") Long vehicleId)
    {
        return success(yongRentalSysVehicleService.selectYongRentalSysVehicleByVehicleId(vehicleId));
    }


}
